package com.jeff.grailsstudy

import com.jeff.grailsstudy.embeded.Country
class Author {
    String name
    int age
    String nickName
    Country country
    
    static hasMany = [books: Book]
    
    static embedded = ["country"]
    
    static mapping = {
        books cascade: /*'all-delete-orphan'*/'all', batchSize: 2, cache: true, fetch: 'join'
        age column: "age_i", sqlType: "tinyint", min: 0, max: 200
    }
    
    static namedQueries = {
        withBooksTitledMyBook {
            books {
                beginWithTitleMyBook() //this query defined in domain class Book
            }
        }
    }
}
